#include "Knife.h"

#include "../../Components/Weapon.h"
#include "../../Components/Blade.h"

#include "../Character.h"
#include "../../StringHelper.h"

#include <iostream>

Knife::Knife(unsigned int weight) 
	: Item("knife", "A small knife with a sharp blade. There's some inscriptions on its wooden hilt.")
{
	this->weight = weight; //1 kg heavy stone

	auto weapon = GameObject::add<Weapon>(std::make_shared<Weapon>());
	weapon->setBluntDmg(0,0);
	weapon->setCutDmg(10, 20);
	weapon->setStabDmg(12, 18);

	auto blade = GameObject::add<Blade>(std::make_shared<Blade>());
	blade->registerCutAirCallback([](const CharacterPtr &character, const RoomPtr &/*room*/)
	{
		if(character->hasPlayer())
			std::cout << "You flimsily cut through the air with your knife, almost toppling over your feet." << std::endl;
		else
			std::cout << StringHelper::toUpper(character->getName()) << " flimsily cut through the air with " << character->getSexAsString() << " knife, almost toppling over " << character->getSexAsString() << " feet." << std::endl;
	});
	blade->registerCutTargetCallback([](const CharacterPtr &character, const CharacterPtr &target, const RoomPtr &/*room*/)
	{
		if(character->hasPlayer())
			std::cout << "You deftly cut at " << target->getIndefiniteArticle() << " " << target->getName() << " with your knife!" << std::endl;
		else if(target->hasPlayer())
			std::cout << StringHelper::toUpper(character->getName()) << " deftly cut you with " << character->getSexAsString() << " knife!" << std::endl;
		else
			std::cout << StringHelper::toUpper(character->getName()) << " deftly cut " <<  target->getIndefiniteArticle() << " " << target->getName() << " with " << character->getSexAsString() << " knife!" << std::endl;
	});
}

Knife::~Knife()
{
}
